import 'package:flutter/material.dart';
import 'package:shimmer/shimmer.dart';

class MShimmer extends StatelessWidget {
  final double width;
  final double height;
  final ShapeBorder shapeBorder;
  final Color baseColor;
  final Color highlightColor;
  final EdgeInsetsGeometry? padding;
  final EdgeInsetsGeometry? margin;

  const MShimmer({
    Key? key,
    required this.width,
    required this.height,
    this.padding,
    this.margin,
    this.shapeBorder = const RoundedRectangleBorder(
      borderRadius: BorderRadius.all(Radius.circular(4)),
    ),
    this.baseColor = const Color(0xff999999),
    this.highlightColor = const Color(0x33000000),
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Shimmer.fromColors(
      baseColor: baseColor,
      highlightColor: highlightColor,
      child: Container(
        width: width,
        height: height,
        padding: padding,
        margin: margin,
        decoration: ShapeDecoration(
          color: const Color(0x4D000000),
          shape: shapeBorder,
        ),
      ),
    );
  }
}
